using NUnit.Framework;
using ValidationFramework.Configuration;
using ValidationFramework.Extensions;

namespace ValidationFramework.Tests.Configuration
{
    [TestFixture]
    public class RequiredBoolRuleConfigReaderTest
    {

        #region Methods

		[Test]
		public void ReadConfig()
		{
            const string validatorXml = "<rule errorMessage='hello' typeName='RequiredBoolRule'  ruleSet='foo' />";
            var ruleData = (RuleData.Read(validatorXml.ToXmlReader()));
			var rule = (RequiredBoolRule)ConfigurationService.GetRule(ruleData, typeof(bool).TypeHandle);
			Assert.AreEqual("hello", rule.ErrorMessage);

		}


		[Test]
		public void ReadConfigNullable()
		{
            const string validatorXml = "<rule errorMessage='hello' typeName='RequiredBoolRule'  ruleSet='foo' />";
            var ruleData = (RuleData.Read(validatorXml.ToXmlReader()));
			var rule = (RequiredBoolRule)ConfigurationService.GetRule(ruleData, typeof(bool?).TypeHandle);
			Assert.AreEqual("hello", rule.ErrorMessage);

		}

        #endregion


    }
}